package com.kakarote.job.hrm;

import com.kakarote.core.utils.UserUtil;
import com.kakarote.hrm.feign.service.HrmService;
import com.xxl.job.core.biz.model.ReturnT;
import com.xxl.job.core.handler.annotation.XxlJob;
import com.xxl.job.core.log.XxlJobLogger;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
@Slf4j
public class OverdueUnAuditJob {

    @Autowired
    private HrmService hrmService;

    @XxlJob("OverdueUnAuditJob")
    public ReturnT<String> overdueUnAuditJobHandler(String param) {
        //超期未审核处理job
        try {
            hrmService.overdueUnAudit();
        } catch (Exception ex) {
            log.error("执行错误", ex);
        } finally {
            UserUtil.removeUser();
        }
        XxlJobLogger.log("逾期未审批节点处理完成！");
        return ReturnT.SUCCESS;
    }
}
